<?php
namespace Core\Helper;

use \Core\Helper;
use \Phalcon\DI;
use \Phalcon\Tag;

/**
 * I18n Formatter
 */
class Formatter extends Helper
{
    /**
     * Get current url.
     *
     * @param mixed $number Number to format.
     * @param mixed $style  Output style.
     *
     * @return mixed
     */
    public function formatNumber($number, $style = \NumberFormatter::DECIMAL)
    {
        $locale = $this->getDI()->get('session')->get('locale');
        $formatter = new \NumberFormatter($locale, $style);

        return $formatter->format($number);
    }

    /**
     * Format currency.
     *
     * @param mixed $number Number to format.
     *
     * @return mixed
     */
    public function formatCurrency($number)
    {
        return $this->_formatNumber($number, \NumberFormatter::CURRENCY);
    }
}